package com.ruoyi.control.service.impl;

import com.ruoyi.control.domain.VipAccount;
import com.ruoyi.control.mapper.VipAccountMapper;
import com.ruoyi.control.service.VipAccountService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * vip账户表(VipAccount)表服务实现类
 *
 * @author Jiuchengi
 * @since 2024-12-18 15:08:27
 */
@Service("vipAccountService")
public class VipAccountServiceImpl implements VipAccountService {
    @Resource
    private VipAccountMapper vipAccountMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param vipId 主键
     * @return 实例对象
     */
    @Override
    public VipAccount queryById(Long vipId) {
        return this.vipAccountMapper.queryById(vipId);
    }

    /**
     * 分页查询
     *
     * @param vipAccount  筛选条件
     * @return 查询结果
     */
    @Override
    public List<VipAccount> queryByPage(VipAccount vipAccount) {
        return vipAccountMapper.queryAllByLimit(vipAccount);
    }

    /**
     * 新增数据
     *
     * @param vipAccount 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(VipAccount vipAccount) {
        return this.vipAccountMapper.insert(vipAccount);
    }

    /**
     * 修改数据
     *
     * @param vipAccount 实例对象
     * @return 实例对象
     */
    @Override
    public int update(VipAccount vipAccount) {
        vipAccount.setUpdateTime(new Date());
        return this.vipAccountMapper.update(vipAccount);
    }

    /**
     * 通过主键删除数据
     *
     * @param vipId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long vipId) {
        return this.vipAccountMapper.deleteById(vipId) > 0;
    }
}
